package com.paton.Selenium;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ProUtil {
	private String filePath;
	private Properties prop;
	public ProUtil(String filePath) throws IOException {
		this.filePath = filePath; 
		this.prop = this.readProperties();
	}
	
	private Properties readProperties(){
		Properties properties = new Properties();
		InputStream inputStream;
		try {
			inputStream = new FileInputStream(filePath);
			BufferedInputStream in = new BufferedInputStream(inputStream);
			properties.load(in);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return properties;
	}
	
	public String getProp(String key) {		
		if(prop.containsKey(key)) {
			String value = prop.getProperty(key);
			return value;
		}else {
			return null;
		}
	}
	
	public static void main(String[] args) throws IOException{
		ProUtil properties = new ProUtil("element.properties");
	}
}
